package com.hison.tandainbao.controller;

import com.hison.tandainbao.entiy.pojo.domain.TbFeedback;
import com.hison.tandainbao.response.ResponseResult;
import com.hison.tandainbao.service.TbFeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: TbFeedbackController
 * @Descripiton: 意见与反馈控制类   必须登录后才能发布
 * @Author: 小郑
 * @Date： 2024/3/30 21:55
 * @Version：1.8
 **/
@RestController
@RequestMapping("/feedback")
@Api(value = "意见与反馈接口",tags = "意见与反馈接口")
public class TbFeedbackController {
    @Autowired
    private TbFeedbackService service;

    /**
     * 添加反馈
     *
     * @param tbFeedback 结核病反馈
     * @return @return {@code ResponseResult }
     * @author $USER$
     * @date 2024/03/30
     * @see TbFeedback
     * @see ResponseResult
     * @since version
     *///用户发布反馈
    @PostMapping("/addFeedback")
    @ApiOperation(value ="用户发布反馈",produces = "application/json",httpMethod = "POST")
    public ResponseResult  addFeedback(@RequestBody TbFeedback tbFeedback){
        return  service.addFeedback(tbFeedback);
    }

    /**
     * 获取我反馈
     *
     * @return @return {@code ResponseResult }
     * @author $USER$
     * @date 2024/03/30
     * @see ResponseResult
     * @since version
     *///用户浏览自己发布的反馈
    @GetMapping("/getMyFeedback")
    @ApiOperation(value = "用户获取自己发布的反馈信息",produces = "application/json",httpMethod = "GET")
    public  ResponseResult  getMyFeedback(){
        return  service.getMyFeedback();
    }

    /**
     * 删除反馈
     *
     * @param feedBackId 反馈 ID
     * @return @return {@code ResponseResult }
     * @author $USER$
     * @date 2024/03/30
     * @see Integer
     * @see ResponseResult
     * @since version
     *///用户删除自己发布的反馈
    @DeleteMapping("/deleteFeedBack/{feedBackId}")
    @ApiOperation(value ="用户删除自己发布的反馈",produces = "application/json",httpMethod = "DELETE")
    public  ResponseResult deleteFeedBack(@PathVariable("feedBackId") Integer feedBackId){
        return  service.deleteFeedBack(feedBackId);
    }

    /**
     * 全部获取
     *
     * @return @return {@code ResponseResult }
     * @author $USER$
     * @date 2024/03/30
     * @see ResponseResult
     * @since version
     *///管理员查看所有的反馈信息
    @GetMapping("/AdminGetAllFeedBack")
    @ApiOperation(value = "管理员查看所有的反馈信息",produces = "application/json",httpMethod = "GET")
    public  ResponseResult  getAll(@RequestParam(value = "current", defaultValue = "1") Integer current, @RequestParam(value = "total",defaultValue = "10") Integer total){
        return  service.getAllFeedBack(current, total);
    }
}